<template>
    <div>
        <home-header :city="city"></home-header>
        <home-swiper :list="swiperList"></home-swiper>
        <div>test</div>
    </div>
</template>

<script>
import HomeHeader from './components/Header'
import HomeSwiper from './components/Swiper'
import axios from 'axios'
 export default {
     name: 'Home',
     components: {
         HomeHeader,
         HomeSwiper
     },
     data(){
         return{
             city: '成都',
             swiperList: []
         }
     },
     methods: {
         getHomeInfo(){
             axios.get('/api/index.json')
                .then(this.getHomeInfoSucc)
         },
         getHomeInfoSucc(res){
             var _this = this;
             var res = res.data;
             if ( res.ret && res.data ) {
                 var data = res.data;
                 _this.city = data.city;
                 _this.swiperList = data.swiperList;
                 console.log(data)
                 
             }
             console.log(res)
         }         
     },
     mounted(){
         this.getHomeInfo()
     }
 }   
</script>

<style>
</style>
